package xcmg.device.infra.enums;

/**
 * @author: xiali@bkrwin.com
 * @description:
 * @date： 2019/6/25 16:44
 **/
public enum AgentReturnStatusEnum {
    NO_RETURN(0, "未退货"),
    PART_RETURN(1, "部分退货"),
    HAS_RETURN(2, "全部退货");

    private Integer code;
    private String desc;


    /**
     * 根据状态码获取枚举实例
     *
     * @param code
     */
    public static AgentReturnStatusEnum getByStatus(Integer code) {
        for (AgentReturnStatusEnum statusEnum : AgentReturnStatusEnum.values()) {
            if (statusEnum.getCode().equals(code)) {
                return statusEnum;
            }
        }
        return null;
    }

    AgentReturnStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
